﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Mads.CoreDomain
{
  /// <summary>
  /// Type of the car with price of this type.
  /// </summary>
  [DataContract]
  public class CarType : VersionedKeyAbstraction
  {
    /// <summary>
    /// Name of this type.
    /// </summary>
    [DataMember]
    public string Name { get; set; }

    /// <summary>
    /// Multiplier of ticket price.
    /// </summary>
    public float PriceMultiplier { get; set; }

    ///<summary>
    ///Nnumber of seats in car
    ///</summary>
    public uint SeatsNumber { get; set; }

    public CarType(uint? id, string name, float priceMultiplier, uint seatsNumber)
    {
      ID = id;

      if (String.IsNullOrEmpty(name))
      {
        throw new ArgumentException("name");
      }
      if (priceMultiplier <= 0)
      {
        throw new ArgumentException("priceMultiplier");
      }

      Name = name;
      PriceMultiplier = priceMultiplier;
      SeatsNumber = seatsNumber;
    }

    public CarType(string name, float priceMultiplier, uint seatsNumber)
      : this(null, name, priceMultiplier, seatsNumber)
    { }
  }
}